﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using TracedReality.RayTracing;

namespace TracedReality.Primitive
{
    public class Instance : Shape
    {
        public Shape shape;
        public Vector translation;

        public Instance(ref Shape s, Vector t)
        {
            shape = s;
            translation = t;

            Vector i = shape.bound.min + translation;
            Vector a = shape.bound.max + translation;
            bound = new BoundingBox(i, a);
        }

        public override bool Equals(Shape s)
        {
            return false;
        }

        public override bool Similar(Shape s)
        {
            return false;
        }

        public override int Intersect(Ray ray, Hit hit)
        {
            Ray transformed = new Ray(ray.origin - translation, ray.direction);
            return shape.Intersect(transformed, hit);
        }
    }
}
